package day0915;

import java.util.LinkedList;

class  Test{
    public static void main(String[] args) {
        J2_Stack s=new J2_Stack();//创建J2_Stack对象
        s.pushToFirst(5);//s调用pushToFirst()
        System.out.println(s.allObjs);
        Integer x=s.popFirst();//s调用popFirst()删除第一个
        System.out.println(x);
    }
}


public class J2_Stack {
    LinkedList<Integer>  allObjs=new LinkedList<>();
    public Integer popFirst(){
        Integer obj=allObjs.removeFirst();//？？？这里的代码怎么写//  对象名.方法名();//调用allObjs的removeFirst();
        return  obj;
    }
    public void pushToFirst(Integer element){
        allObjs.addFirst(element);
    }

}



